<?php

class Klass {
    
    private $data;
    
    public function __construct(array $data) {
        $this->data = $data;
    }
    
    public function __get($attr) {
        return isset($this->data[$attr]) ? $this->data[$attr] : null;
    }
    
    public function __set($attr, $val) {
        $this->data[$attr] = $val;
    }
    
}

?>